home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / desktop-base.preinst < prev    next >
Encoding:
Text File  |  2011-02-26  |  2.7 KB  |  75 lines

  1. #!/bin/sh -e
  2.  
  3.  
  4. if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
  5.   dpkg-maintscript-helper rm_conffile /etc/kde3/kdeglobals 6.0.1 -- "$@"
  6. fi
  7.  
  8. if [ "${1}" = "upgrade" ]; then
  9.     if dpkg --compare-versions ${2} lt 0.3.11 && dpkg --compare-versions ${2} gt 0.3.5; then
  10.         update-alternatives --remove gnome-splash \
  11.             /usr/share/images/desktop-base/Splash-Debian.png
  12.         update-alternatives --remove gnome-splash \
  13.             /usr/share/images/desktop-base/Splash-EvolvingTux.png
  14.         update-alternatives --remove gnome-splash \
  15.             /usr/share/images/desktop-base/Splash-Debian_red.png
  16.  
  17.         dpkg-divert --package desktop-base --rename \
  18.             --divert /usr/share/pixmaps/splash/gnome-splash.png.orig \
  19.             --remove /usr/share/pixmaps/splash/gnome-splash.png
  20.     fi
  21. fi
  22.  
  23. same_conffile() {
  24.   CONFFILE="$1"
  25.   if [ -e "$CONFFILE" ]; then
  26.     md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  27.     old_md5sum="`dpkg-query -W -f='${Conffiles}' desktop-base | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
  28.     [ "$md5sum" = "$old_md5sum" ]
  29.     return
  30.   fi
  31.   return 1
  32. }
  33.  
  34. case "$1" in
  35.   install|upgrade)
  36.     if dpkg --compare-versions "$2" lt "5.0.2"; then
  37.       # if the folder is a symlink (installed by splashy), modified files
  38.       # need to be copied (from /usr/share/splashy/themes) before beeing 
  39.       # replaced. If it's not, they need to be moved (from
  40.       # /etc/splashy/themes)
  41.       # not modified files need to be removed if no symlink, and not
  42.       # touched in case of a symlink
  43.       THEME_FOLDER="/etc/splashy/themes/moreblue-orbit"
  44.       THEME_FOLDER_BAK="/etc/splashy.dpkg-old/themes/moreblue-orbit"
  45.       FILES="background-bw.png background-color.png VeraSans.ttf theme.xml"
  46.  
  47.       if [ -h /etc/splashy/themes ]; then
  48.       # symlink
  49.         for FILE in ${FILES}; do
  50.           [ -f ${THEME_FOLDER}/${FILE} ] || break
  51.           if ! same_conffile "${THEME_FOLDER}/${FILE}"; then
  52.           # symlink and changed file, copy it in a safe place
  53.             [ -d $THEME_FOLDER_BAK ] || mkdir -p $THEME_FOLDER_BAK
  54.             cp ${THEME_FOLDER}/${FILE} ${THEME_FOLDER_BAK}/
  55.           fi
  56.         done
  57.       else
  58.       # real folder
  59.         for FILE in ${FILES}; do
  60.           [ -f ${THEME_FOLDER}/${FILE} ] || break
  61.           if ! same_conffile "${THEME_FOLDER}/${FILE}"; then
  62.           # real folder and changed file, move it in a safe place
  63.             [ -d $THEME_FOLDER_BAK ] || mkdir -p $THEME_FOLDER_BAK
  64.             mv ${THEME_FOLDER}/${FILE} ${THEME_FOLDER_BAK}/
  65.           else
  66.           # real folder but unchanged file, just remove it
  67.             rm ${THEME_FOLDER}/${FILE}
  68.           fi
  69.         done
  70.       fi
  71.     fi
  72.   ;;
  73. esac
  74.  
  75.